
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- content.js -->
<link rel="shortcut icon" href="../favicon.ico"/>
<link rel="stylesheet" href="../css/icon/icon_font/iconfont.css"/>
<link rel="stylesheet" href="../css/index/font1/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../plug/paging/css/yeIcon/iconfont.css">


<link rel="stylesheet" href="../css/user/index.css" />
<link href="../AceAdmin/assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../AceAdmin/assets/css/font-awesome.min.css" />
<link rel="stylesheet" href="../AceAdmin/assets/css/ui.jqgrid.css" />
<link rel="stylesheet" href="../AceAdmin/assets/css/chosen.css" />
<link rel="stylesheet" href="../AceAdmin/assets/css/ace.min.css" />
<!-- <script src="../js/configuration.js" type="application/javascript"></script> -->

<script src="../js/common.js" type="application/javascript"></script>
<script src="../AceAdmin/assets/js/ace-extra.min.js"></script>
<style type="text/css">
    html,body{
        width:100%;
        height: 100%;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
    .color{
        color:#428bca;
    }
    #indexTopRs{
        position: absolute;
        top: 10px;
        right: 10px;
    }
     #messagedivs{
        width:100%;
        height:100%;
        position:absolute;
        background:rgba(0,0,0,0.5);
        top:0;
        bottom:0;
        display:none;
    }
    #messagediv{
        width: 100%;
        height: 100%;
        display: flex;
    }
    .popup{
        width:650px;
        height:80%;
        margin: auto;
        vertical-align: middle;
        background:#fff;
        position:relative;

    }
    .popupTitle{
        width:100%;
        line-height:50px;
        text-align:center;
        font-weight:bold;
        border-bottom:1px solid #ccc;
    }
    .popupCenter{
        width:calc(100% - 40px);
        height:calc(100% - 100px);
        padding:0 20px;
        overflow-y:auto;
    }
    .popupBottom{
        width:100%;
        height:50px;
        border-top:1px solid #ccc;
        position:relative;
    }
    .popupYes{
        width:60px;
        line-height:30px;
        text-align:center;
        background:#428bca;
        color:#fff;
        position:absolute;
        right:10px;
        top:10px;
    }
    .padlock{
        width:30px;
        height:30px;
        line-height: 30px;
        text-align:center;
        border-radius:50%;
        border:1px solid #ccc;
        position:absolute;
        right:10px;
        top:10px;
    }
    .popupCenters{
        width:100%;
        height:calc(100% - 100px);
        padding:0 20px;
        overflow-y:auto;
        display: flex;
    }
    .popupCentersImg{
        width:300px;
        height: 300px;
        margin: auto;
        vertical-align: middle;
    }
    .radarImg{
        width:100%;
        height: 100%;
        
    }
    .kongradar{
        height: 10px;
    }
    .popupYes2{
        width:80px;
        line-height: 30px;
        text-align: center;
        background: #428bca;
        color:#fff;
        margin: auto;
    }
    .namesClass{
        line-height: 25px;
    }
    .imgClass123{
        display: flex;
        margin-top: 10px;
      }
      .guin123{
        width: 70px;
        line-height: 25px;
      }
      #cruxAdd123{
        width: calc(100% - 70px);
      }
      .inp123{
        display: flex
      }
      .inpYes123{
        width: 50px;
        height: 25px;
        line-height: 25px;
        background: #4f81d4;
        color: #fff;
        border-radius:2px;
        text-align: center;
        margin-left: 15px;
      }
      .dininput123{
        height: 25px;
        line-height: 25px;
      }
      .specificaz{
        width:60%;
        line-height:30px;
        border:1px solid #ddd;
        border-radius:3px;
        position: relative;
        margin: 5px 0;
        text-indent: 5px;
      }
      .delInp{
        /*text-align: right;*/
        position: absolute;
        top: 0px;
        right: 0;
        background: #fb3838;
        padding: 5px;
        font-size: 15px;
        line-height: 20px;
        border-radius: 3px;
        color: #fff;
      }
      .newAdds{
        height: calc(100% - 65px);
        padding: 0 0 0 10px;
        overflow-y: auto;
      }
      #loads{
        position: fixed;
        top: 0;
        left: 0;
        background:rgba(0,0,0,0);
        width:100%;
        height: 100%;
        /*display:flex;*/
        vertical-align: middle;
        z-index:99999;
      }
      .load1Img{
        width:100%;
        height:auto;
        border-radius:5px;
        background: rgba(0,0,0,0.5);
      }
    .companyName{
        line-height: 40px;
        font-size: 18px;
        color: #4f81d4;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
</style>
</head>
<body>
    <div class="main-container" id="main-container">
        <div class="navbar-default indexTop" id="navbar" style="background: #fff;border-bottom:1px solid #ccc;position: relative;">
            <div class="navbar-container indexTopZ" id="navbar-container">
                <div class="indexTopL" style="width: calc(100% - 80px);">
                    <!-- <a href="#" > -->
                        <div class="indexTitle" style="width: 100%">
                            <img src="" class="companylogo">
                            <div class="logo-word" style="width: calc(100% - 60px);">
                                <div style="color：#000" class="companyName"></div>
                                <!-- <div style="color：#000">Snack Petty Vendor</div> -->
                            </div>
                        </div>
                    <!-- </a> -->
                </div>
                <div class="navbar-header pull-right " id="indexTopRs" role="navigation">
                    <div style="height: 28px;"></div>
                <a class="register" id="login-out" title="退出" style="padding:3px 10px;border-radius:3px;cursor: pointer;color: #fff;background: #4f81d4;">退出</a>
                </div>
            </div>
        </div>
        <div class="main-container-inner" style="overflow-y:auto">
            <a class="menu-toggler" id="menu-toggler" href="#">
                <span class="menu-text"></span>
            </a>
            <div class="sidebar" id="sidebar" style="overflow-y:auto">
                <ul class="nav nav-list">
                    <li>
                        <a href="#index/index" name="index/index" id="index" class="register">
                            <i class="icon-home"></i>
                            <span class="menu-text">首页</span>
                        </a>
                        <ul class="submenu"></ul>
                    </li>
                    <li>
                        <a href="#" class="dropdown-toggle">
                            <i class="icon-desktop"></i>
                            <span class="menu-text">企业号管理</span>

                            <b class="arrow icon-angle-down"></b>
                        </a>

                        <ul class="submenu">
                           <!--  <li>
                                <a href="#company/department" id="active" name="company/department" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    部门管理
                                </a>
                            </li> -->
                            <li>
                                <a href="#company/organization" id="active" name="company/organization" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    组织架构
                                </a>
                            </li>
                            <li>
                                <a href="#company/radar" id="radar" name="company/radar" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    雷达权限管理
                                </a>
                            </li>
                            <li>
                                <a href="#company/verbal" id="verbal" name="" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    话术库
                                </a>
                            </li>
                            <li>
                                <a href="#company/associate" id="associate" name="" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    工作交接
                                </a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="#" class="dropdown-toggle">
                            <i class="icon-gift"></i>
                            <span class="menu-text">商城管理</span>

                            <b class="arrow icon-angle-down"></b>
                        </a>
                        <ul class="submenu">
                            <li>
                                <a href="#shopping/indent" id="indent" name="shopping/indent" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    订单管理
                                </a>
                            </li>
                            
                            <li>
                                <a href="#shopping/shopClass" id="shopClass" name="shopping/shopClass" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    商城分类管理
                                </a>
                            </li>
                            <li>
                                <a href="#shopping/specification" id="specification" name="shopping/specification" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    商城规格管理
                                </a>
                            </li>
                            <li>
                                <a href="#shopping/shopManage" id="shopManage" name="shopping/shopManage" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    商品管理
                                </a>
                            </li>
                            <li>
                                <a href="#shopping/activity" id="activity" name="shopping/activity" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    活动管理
                                </a>
                            </li>
                            <!-- <li>
                                <a href="#shopping/afterSale" id="afterSale" name="shopping/afterSale" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    售后管理
                                </a>
                            </li>
                            
                            <li>
                                <a href="#shopping/refund" id="refund" name="shopping/refund" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    退款单管理
                                </a>
                            </li>
                            <li>
                                <a href="#shopping/staff" id="staff" name="shopping/staff" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    员工订单统计
                                </a>
                            </li> -->

                            <!-- <li>
                                <a href="#" id="pp" name="shopping/indent" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    特权折扣
                                </a>
                            </li> -->
                            
                        </ul>
                    </li>
                   
                    <li>
                        <a href="#" class="dropdown-toggle">
                            <i class="icon-list"></i>
                            <span class="menu-text">授权管理</span>

                            <b class="arrow icon-angle-down"></b>
                        </a>
                        <ul class="submenu">
                            <li>
                                <a href="#accredit/applet" id="applet" name="accredit/applet" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    小程序授权
                                </a>
                            </li>
                            <li>
                                <a href="#accredit/enterprise" id="enterprise" name="accredit/enterprise" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    企业号授权
                                </a>
                            </li>

                        </ul>
                    </li>
                 <!--    <li>
                        <a href="#" class="dropdown-toggle">
                            <i class="icon-book"></i>
                            <span class="menu-text">客户管理</span>

                            <b class="arrow icon-angle-down"></b>
                        </a>
                        <ul class="submenu">
                            <li>
                                <a href="#" id="active1" name="indent" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    任务设置
                                </a>
                            </li>
                            <li>
                                <a href="#" id="ce1" name="cs" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    商机设置
                                </a>
                            </li>

                        </ul>
                    </li> -->
                    <li>
                        <a href="#" class="dropdown-toggle">
                            <i class="icon-laptop"></i>
                            <span class="menu-text">小程序管理</span>

                            <b class="arrow icon-angle-down"></b>
                        </a>
                        <ul class="submenu">
                            <!-- <li>
                                <a href="#" id="" name="" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    个人产品
                                </a>
                            </li> -->
                       <!--      <li>
                                <a href="#" id="" name="" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    公司产品
                                </a>
                            </li> -->
                            <!-- <li>
                                <a href="#applet/card" id="card" name="applet/card" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    默认名片
                                </a>
                            </li> -->
                            <li>
                                <a href="applet/official.html" id="official" name="" class="register" target="_blank">
                                    <i class="icon-double-angle-right"></i>
                                    官网编辑
                                </a>
                            </li>
                            <li>
                                <a href="#applet/set" id="set" name="applet/set" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    商城设置
                                </a>
                            </li>
                            <!-- <li>
                                <a href="#" id="" name="" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    企业动态
                                </a>
                            </li> -->
                         <!--    <li>
                                <a href="#" id="" name="" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    表单管理
                                </a>
                            </li> -->

                        </ul>
                    </li>
                    
                    <!-- <li>
                        <a href="#" class="dropdown-toggle">
                            <i class="icon-group"></i>
                            <span class="menu-text">小程序推广</span>

                            <b class="arrow icon-angle-down"></b>
                        </a>
                        <ul class="submenu">
                            <li>
                                <a href="#activity/activity" id="activity" name="activity/activity" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    分发活动管理
                                </a>
                            </li> -->
                           <!--  <li>
                                <a href="#" id="ce1" name="cs" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    公众号内推广
                                </a>
                            </li> -->
                      <!--   </ul>
                    </li> -->
                   <!--  <li>
                        <a href="#" class="dropdown-toggle">
                            <i class="icon-globe"></i>
                            <span class="menu-text">其他服务</span>

                            <b class="arrow icon-angle-down"></b>
                        </a>
                        <ul class="submenu">
                            <li>
                                <a href="#" id="active1" name="indent" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    工单系统
                                </a>
                            </li>
                            <li>
                                <a href="#" id="ce1" name="cs" class="register">
                                    <i class="icon-double-angle-right"></i>
                                    增值服务
                                </a>
                            </li>
                        </ul>
                    </li> -->
                     <li>
                        <a href="#account/account" id='account' name="account/account" class="register">
                            <i class="icon-user"></i>
                            <span class="menu-text">账号中心</span>
                        </a>
                        <ul class="submenu"></ul>
                    </li>
                </ul>
                <div class="sidebar-collapse" id="sidebar-collapse">
                    <i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i>
                </div>
                <script type="text/javascript">
                </script>
            </div>
            <!-- <input type="text" id="hidInp" value="hidtext" style="opacity:0;"><a href="javascript:void(0);" id="addTabpp" onclick="addpp()" style="opacity:0;">           &nbsp;</a> -->

            <div class="main-content">
                <div class="page-content" id="page-content">
                    <iframe src="" id="iframe" frameborder="0" scrolling="no" onload="this.height=100"></iframe>
                </div>
            </div>
        </div>
    </div>
    <div id="loads" style="display:none">
        <div style="width:100%;height:100%;display:flex;vertical-align: middle;">
            <div style="width:100px;height:140px;margin: auto;">
                <img src="../imgs/load.gif" alt="" class="load1Img" />
                <div class="loadFont" style='width:100%;text-align: center;display: block;color:#fff;font-size: 20px;'></div>
            </div>
        </div>
    </div>
    <div id="messagedivs"><div id="messagediv"></div></div>  
    <script type="text/javascript">
        window.jQuery || document.write("<script src='../AceAdmin/assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
    </script>
    <script type="text/javascript">
        if("ontouchend" in document) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
    </script>
    <script src="../AceAdmin/assets/js/jquery.dataTables.min.js"></script>
    <script src="../AceAdmin/assets/js/jquery.dataTables.bootstrap.js"></script>
    <script src="../AceAdmin/assets/js/bootstrap.min.js"></script>
    <script src="../AceAdmin/assets/js/typeahead-bs2.min.js"></script>
    <script src="../AceAdmin/assets/js/chosen.jquery.min.js"></script>
    <script src="../AceAdmin/assets/js/ace-elements.min.js"></script>
    <script src="../AceAdmin/assets/js/ace.min.js"></script>
    <script src="../AceAdmin/assets/js/bootbox.min.js"></script>

<div style="display:none"></div>
    
    <script type="text/javascript">
        IEVersion()
        function IEVersion() {
            var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串  
            var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器  
            var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器  
            var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
            if(isIE) {
                var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
                reIE.test(userAgent);
                var fIEVersion = parseFloat(RegExp["$1"]);
                if(fIEVersion == 7) {
                    console.log(7);
                } else if(fIEVersion == 8) {
                    console.log(8);
                } else if(fIEVersion == 9) {
                    console.log(9);
                } else if(fIEVersion == 10) {
                    console.log(10);
                } else {
                    console.log(6);//IE版本<=7
                }   
            } else if(isEdge) {
                $(".register").each(function(htmlindex,htmls){
                    console.log(htmlindex,htmls)
                    htmls.onclick = function(){
                        console.log(htmls.getAttribute("name"))
                    }
                })
                console.log('edge') ;//edge
            } else if(isIE11) {
                console.log(11); //IE11  
            }else{
                console.log(99);//不是ie浏览器
            }
        }

        jQuery(document).ready(function () {
              if (window.history && window.history.pushState) {
                  $(window).on('popstate', function () {
                        // 当点击浏览器的 后退和前进按钮 时才会被触发， 
                        window.history.pushState('forward', null, ''); 
                        window.history.forward(1);
                  });
              }
    　　　　　　　　　　//
              window.history.pushState('forward', null, '');  //在IE中必须得有这两行
              window.history.forward(1);
        });
        if(!localStorage.getItem('token')){
            window.location.href = 'https://business.17jxyx.com/login.html';
        }

    // console.log(JSON.parse(localStorage.getItem('token')).val)

        // console.log( https://minitest.17jxyx.com/api/v1/      console.log(JSON.parse(localStorage.getItem('company')))
        showAjax()
        function showAjax(){
            $.ajax({
                url:"https://minitest.17jxyx.com/api/v1/app/user/info",
                type:"GET",
                contentType: "application/json",
                dataType:"json",
                beforeSend: function (request) {
                    request.setRequestHeader('token', JSON.parse(localStorage.getItem('token')).val);
                },
                success:function(res){
                    // console.log(res)
                    document.title = res.name + "－管理平台"
                    $(".companyName").html(res.name)
                    $(".companylogo").attr("src",res.img.url)
                    localStorage.setItem('company',JSON.stringify(res));
                },
            });
        }

        // console.log(window)
        document.querySelector("#sidebar").style.height =  window.innerHeight - 80 +"px"
        var newUrl = window.base.getLocalStorage('newUrl');
        // var se = window.getCookie('newUrl');
        // console.log(se)
        if(newUrl != ''){
            $("#iframe").attr("src",newUrl).ready();
        }else{
            $("#iframe").attr("src","index/index").ready();
        }
        // $("#ce1").click(function(){

        //     // function tonewsDetail(sequenceId) {//子页面方法  
        //     //     var url = "cs.html?toDetailName=" + sequenceId + "&itemId=1";  
        //     //     window.parent.showFirstPageDetail(url);  
        //     // }  
        //       
        //     // function showFirstPageDetail(url){//父页面方法  
        //     //     $("#firstPage").hide();  
        //     //     $("#elseAll").hide();  
        //     //     $("#messagePage").hide();  
        //     //     $("#detail-content_all").hide();  
        //     //     $("#jncsDiv").show();  
        //     // $("#iframe").attr("src","cs.html").ready();
        //     // }  
        // })
        var register = document.querySelectorAll(".register");
        Array.from(register).forEach(function(dom,index){
            dom.onclick = function(){
                Array.from(register).forEach(function(dom1,index1){
                    dom1.parentNode.classList.remove("active");
                })
                dom.parentNode.classList.add("active");
            }
        })
        
        window.onhashchange = function(){
            var hash = location.hash;
            console.log(hash)
            var name = hash.substring(1,hash.length);
            console.log(name)

            $("#iframe").attr("src",name+'.html').ready();
            window.base.setLocalStorage('newUrl',name+'.html');
            document.querySelector(".main-container-inner").scrollTop = 0;
        }
        if(!window.base.getLocalStorage('token')){
            window.location.href = 'https://business.17jxyx.com/login.html';
        }
        $("#login-out").click(function(){
            localStorage.removeItem('company');
            window.base.deleteLocalStorage('token');
            window.base.deleteLocalStorage('newUrl');
            window.location.href = "https://business.17jxyx.com/loginOut?redirect_url="+ window.location.href

        })
        //组织架构--添加成员--部门选择
        function newOrganizations(){
            var div='';
            var departments = document.querySelectorAll(".staffBott")
            Array.from(departments).forEach(function(a,b){
              if(a.checked == true){
                if(div){
                    div = div + "<div class='dispenseSon' sid='"+a.getAttribute('sid')+"'>"+a.getAttribute('cid')+"</div>"
                }else{
                    div = "<div class='dispenseSon' sid='"+a.getAttribute('sid')+"'>"+a.getAttribute('cid')+"</div>"
                }
              }
            })
            var dispensesSon = $('#iframe').contents().find("#chooseNews").children()
            if(dispensesSon.length>0){
                dispensesSon.each(function(c,d){
                    d.remove()
                })
            }
            $(div).appendTo($('#iframe').contents().find("#chooseNews"))
            div=''

            $("#messagedivs").css("display","none")
            $(".popup").remove()
        }
        //组织架构--部门修改
        function updataOrganizations(){
            var div='';
            var departments = document.querySelectorAll(".staffBott")
            Array.from(departments).forEach(function(a,b){
              if(a.checked == true){
                if(div){
                    div = div + "<div class='dispenseSons' sid='"+a.getAttribute('sid')+"' cid='"+$(".popupYes").attr("sid")+"'>"+a.getAttribute('cid')+"</div>"
                }else{
                    div = "<div class='dispenseSons' sid='"+a.getAttribute('sid')+"' cid='"+$(".popupYes").attr("sid")+"'>"+a.getAttribute('cid')+"</div>"
                }
              }
            })
            $("#messagedivs").css("display","none")
            $(".popup").remove()
        }
        //雷达管理权限--部门选择
        function radarOrganizations(){
            // console.log(this)
            // console.log($(".popupYes").attr("sid"))
            var div='';
            var departments = document.querySelectorAll(".staffBott")
            // console.log(departments)
            
            // console.log(departments)

            Array.from(departments).forEach(function(a,b){
              if(a.checked == true){
                console.log(a)
                div = div + "<div class='dispenseSons' sid='"+a.getAttribute('dids')+"' cid='"+a.getAttribute('cis')+"'>"+a.getAttribute('cis')+"</div>"
              }
            })
            // console.log(div)
            var dispensesSon = $('#iframe').contents().find("#radarNews").children()
            if(dispensesSon.length>0){
                dispensesSon.each(function(c,d){
                    d.remove()
                })
            }
            $(div).appendTo($('#iframe').contents().find("#radarNews"))
            // $('#iframe').contents().find("#radarNews").attr("cid",$(".popupYes").attr("sid"));
            div=''

            $("#messagedivs").css("display","none")
            $(".popup").remove()
        }
        //雷达管理权限--批量开通开通
        function radarOrganization(){
            // console.log(this)
            
            var div='';
            var departments = document.querySelectorAll(".dredgeO")
            Array.from(departments).forEach(function(a,b){
              if(a.checked == true){
                if(div){
                    div = div + "<div class='dispenseSonss' sid='"+a.getAttribute('did')+"'>"+a.getAttribute('did')+"</div>"
                }else{
                    div = "<div class='dispenseSonss' sid='"+a.getAttribute('did')+"'>"+a.getAttribute('did')+"</div>"
                }
              }
            })
            // console.log(div)
            var dispensesSon = $('#iframe').contents().find("#radarUpdatas").children()
            if(dispensesSon.length>0){
                dispensesSon.each(function(c,d){
                    d.remove()
                })
            }
            $(div).appendTo($('#iframe').contents().find("#radarUpdatas"))
            // $('#iframe').contents().find("#radarUpdatas").attr("cid",$(".popupYes").attr("sid"));
            div=''

            $("#messagedivs").css("display","none")
            $(".popup").remove()
        }
        //雷达管理权限--获取用户二维码
        //
        function acquireAjax(id){
            $("#loads").css("display","block")
            document.querySelector(".radarImg").src = ''
          $.ajax({
            url:"https://minitest.17jxyx.com/api/v1/member/qrcode/" + id,
            type:"GET",
            contentType: "application/json",
            dataType:"json",
            beforeSend: function (request) {
                request.setRequestHeader('token', window.base.getLocalStorage('token'));
            },
            success:function(res){
                $("#loads").css("display","none")
              // console.log(res)
              // console.log(res.url)
              document.querySelector(".radarImg").src = res.url
            },
            error:function(res){
                $("#loads").css("display","none")
                if(JSON.parse(res.responseText).error_code == 10001){
                    if(confirm("对不起，你的身份已经过期，请重新登陆")){
                        // alert("对不起，你的身份已经过期，请重新登陆")
                        localStorage.removeItem('company');
                        window.base.deleteLocalStorage('token');
                        window.base.deleteLocalStorage('newUrl');
                        window.parent.location.href = window.parents.url;
                        
                    }
                }
              // console.log(res)
            }
          });
        }

        //工作交接--交出方弹框
        function hands(that){
            // console.log($("input[name='name']:checked").attr("sid"));
            // console.log($("input[name='name']:checked").attr("cid"));
            console.log($(that))
            // console.log($('#iframe').contents().find("#connectR").attr("cid"))

            console.log($(that).attr("did"))
            if($('#iframe').contents().find("#connectR").attr("cid") == $("input[name='name']:checked").attr("cid")){
                alert("交出方与接收方不能相同")
                return false;
            }else{
                oneAjax($("input[name='name']:checked").attr("cid"),"handover",$(that).attr("did"),$("input[name='name']:checked").attr("cid"))
                
            }
        }
        //工作交接--接手方弹框
        function reception(that){
            // console.log($("input[name='name']:checked").attr("sid"));
            // console.log($("input[name='name']:checked").attr("cid"));
            // console.log($('#iframe').contents().find("#connectL").attr("cid"))
            console.log($(that))
            console.log($(that).attr("did"))
            if($('#iframe').contents().find("#connectL").attr("cid") == $("input[name='name']:checked").attr("cid")){
                alert("接手方与交出方不能相同")
                return false;
            }else{
                oneAjax($("input[name='name']:checked").attr("cid"),"receiver",$(that).attr("did"),$("input[name='name']:checked").attr("cid"))
                
            }
        }
        //活动管理--优惠券选择商品类
        function activityClass(){
            // console.log($("input[name='activityClass']:checked").attr("sid"));
            // console.log($("input[name='activityClass']:checked").attr("cid"));
            var div='';
            var departments = document.querySelectorAll(".activityClass")
            // console.log(departments)
            Array.from(departments).forEach(function(a,b){
              if(a.checked == true){
                if(div){
                    div = div + "<div class='activityClassSon' sid='"+a.getAttribute('sid')+"'>"+a.getAttribute('cid')+"</div>"
                }else{
                    div = "<div class='activityClassSon' sid='"+a.getAttribute('sid')+"'>"+a.getAttribute('cid')+"</div>"
                }
              }
            })
            // console.log(div)
            var dispensesSon = $('#iframe').contents().find("#activityClass").children()
            if(dispensesSon.length>0){
                dispensesSon.each(function(c,d){
                    d.remove()
                })
            }
            $(div).appendTo($('#iframe').contents().find("#activityClass"))
            // $('#iframe').contents().find("#activityClass").attr("cid",$(".popupYes").attr("sid"));
            if (div == '') {
                alert("请选择商品类")
            }else{
                div=''
                $("#messagedivs").css("display","none")
                $(".popup").remove()
            }
        }
        //活动管理--优惠券选择商品
        function activityShop(){
            // console.log($("input[name='activityShop']:checked").attr("sid"));
            // console.log($("input[name='activityShop']:checked").attr("cid"));
            var div='';
            var departments2 = document.querySelectorAll(".activityShop")
            // console.log(departments2)
            Array.from(departments2).forEach(function(a,b){
              if(a.checked == true){
                if(div){
                    div = div + "<div class='activityShopSon' sid='"+a.getAttribute('sid')+"'>"+a.getAttribute('cid')+"</div>"
                }else{
                    div = "<div class='activityShopSon' sid='"+a.getAttribute('sid')+"'>"+a.getAttribute('cid')+"</div>"
                }
              }
            })
            // console.log(div)
            var dispensesSon = $('#iframe').contents().find("#activityShop").children()
            if(dispensesSon.length>0){
                dispensesSon.each(function(c,d){
                    d.remove()
                })
            }
            $(div).appendTo($('#iframe').contents().find("#activityShop"))
            // $('#iframe').contents().find("#activityShop").attr("cid",$(".popupYes").attr("sid"));
            if (div == '') {
                alert("请选择商品")
            }else{
                div=''
                $("#messagedivs").css("display","none")
                $(".popup").remove()
            }
            // div=''

            // $("#messagedivs").css("display","none")
            // $(".popup").remove()
        }

        //获取客户数
        function oneAjax(id,index,hand,over){
            console.log(index)
            $.ajax({
                url:"https://minitest.17jxyx.com/api/v1/member/number/" + id,
                type:"POST",
                contentType: "application/json",
                dataType:"json",
                data:JSON.stringify({
                    type:index
                }),
                beforeSend: function (request) {
                  request.setRequestHeader('token', window.base.getLocalStorage('token'));
                },
                
                success:function(res){
                    console.log(res)
                    // console.log(res.users_count,index)
                    if(index == "handover"){
                        console.log(res.num)
                        if(res.num == undefined){
                            if(confirm("该成员的CRM还未关闭，是否立即去关闭？")){
                                window.location.href='https://business.17jxyx.com/pages/index.html#company/radar'
                                $("#messagedivs").css("display","none")
                                $(".popup").remove()
                            }
                        } else{
                            if(res.num == 0){
                                alert("交出方客户数不能小于1")
                            }else{
                                $('#iframe').contents().find("#numSpanL").html(res.num);
                                $('#iframe').contents().find("#connectL").html($("input[name='name']:checked").attr("sid"));
                                $('#iframe').contents().find("#connectL").attr("cid",$("input[name='name']:checked").attr("cid"));
                                $("#messagedivs").css("display","none")
                                $(".popup").remove()
                            }
                        }
                        // if(res.num){
                        //     if(res.num == 0){
                        //         alert("交出方客户数不能小于1")
                        //     }else{
                        //         $('#iframe').contents().find("#numSpanL").html(res.num);
                        //         $('#iframe').contents().find("#connectL").html($("input[name='name']:checked").attr("sid"));
                        //         $('#iframe').contents().find("#connectL").attr("cid",$("input[name='name']:checked").attr("cid"));
                        //         $("#messagedivs").css("display","none")
                        //         $(".popup").remove()
                        //     }
                        // }else{
                        //     if(confirm("该成员的CRM还未关闭，是否立即去关闭？")){
                        //         window.location.href='https://business.17jxyx.com/pages/index.html#company/radar'
                        //         $("#messagedivs").css("display","none")
                        //         $(".popup").remove()
                        //     }
                        // }
                        
                    }else{
                        if(res.num == undefined){
                             if(confirm("该成员的CRM还未开通，是否立即去开通？")){
                                window.location.href='https://business.17jxyx.com/pages/index.html#company/radar'
                                $("#messagedivs").css("display","none")
                                $(".popup").remove()
                            }
                        }else{
                            $('#iframe').contents().find("#numSpanR").html(res.num);
                            $('#iframe').contents().find("#connectR").html($("input[name='name']:checked").attr("sid"));
                            $('#iframe').contents().find("#connectR").attr("cid",$("input[name='name']:checked").attr("cid"));
                            $("#messagedivs").css("display","none")
                            $(".popup").remove()
                        }
                    }
                    if(hand != 0){
                        if(res.num != undefined){
                            $.ajax({
                                url:"https://minitest.17jxyx.com/api/v1/member/result",
                                type:"POST",
                                contentType: "application/json",
                                dataType:"json",
                                data:JSON.stringify({
                                    handoverId:hand,
                                    receiverId:over
                                }),
                                beforeSend: function (request) {
                                  request.setRequestHeader('token', window.base.getLocalStorage('token'));
                                },
                                
                                success:function(res){
                                    console.log(res)
                                    $('#iframe').contents().find("#associateHand").css("display","block");
                                    $('#iframe').contents().find("#associateNum").html(res.num);
                                    $('#iframe').contents().find("#associateCoincide").html(res.coincide);
                                    $('#iframe').contents().find("#associateResult").html(res.result);
                                },
                                error:function(res){
                                    console.log(res)
                                }
                            });
                            
                        }
                    }
                },
                error:function(res){
                    console.log(res)
                }
            });
        }

        //商品管理--批量移动分类
        function shopManageClass(){
            // console.log(this)
            
            var div='';
            var departments = document.querySelectorAll(".shopManageClass")
            // console.log(departments)
            Array.from(departments).forEach(function(a,b){
              if(a.checked == true){
                if(div){
                    div = div + "<div class='dispenseSonss' sid='"+a.getAttribute('sid')+"'>"+a.getAttribute('cid')+"</div>"
                }else{
                    div = "<div class='dispenseSonss' sid='"+a.getAttribute('sid')+"'>"+a.getAttribute('cid')+"</div>"
                }
              }
            })
            // console.log(div)
            var dispensesSon = $('#iframe').contents().find("#shopManageClass").children()
            if(dispensesSon.length>0){
                dispensesSon.each(function(c,d){
                    d.remove()
                })
            }
            $(div).appendTo($('#iframe').contents().find("#shopManageClass"))

            // $('#iframe').contents().find("#radarUpdatas").attr("cid",$(".popupYes").attr("sid"));
            if (div == '') {
                alert("请选择商品")
            }else{
                div=''
                $("#messagedivs").css("display","none")
                $(".popup").remove()
            }

            $("#messagedivs").css("display","none")
            $(".popup").remove()
        }
        //商品管理--编辑规格
        function specificationClass(){
            var div='';
            // var departments = document.querySelectorAll(".specificationClass")
            // console.log(departments)
            var arr_H1 = $(".specificaz")
            // console.log(arr_H1)
            var addArrs = []
            Array.from(arr_H1).forEach(function(domH,indH){
                if(domH.getAttribute("id").slice(0,1) == "n"){
                    addArrs.push(domH.childNodes[0].innerHTML)
                    
                }
            })
            // specificationClass
            var div;
            addArrs.forEach(function(a,b){ //添加
                if(div){
                    div = div + "<div class='shopManageClass1' sid='"+a+"'>"+a+"</div>"
                }else{
                    div = "<div class='shopManageClass1' sid='"+a+"'>"+a+"</div>"
                }
            })
            delarr_h.forEach(function(c,d){ //添加
                if(div){
                    div = div + "<div class='shopManageClass2' sid='"+c.id+"'>"+c.id+"</div>"
                }else{
                    div = "<div class='shopManageClass2' sid='"+c.id+"'>"+c.id+"</div>"
                }
            })
            var dispensesSon = $('#iframe').contents().find("#specificationClass").children()
            if(dispensesSon.length>0){
                dispensesSon.each(function(c,d){
                    d.remove()
                })
            }

            $(div).appendTo($('#iframe').contents().find("#specificationClass"))
            // console.log(delarr_h,addArrs)
           
            // console.log(delarr_h,guiArr)
            if($(".specificaz").length<1){
                alert("规格不能为空")
            }else{
                delarr_h = []
                div=''
                $("#messagedivs").css("display","none")
                $(".popup").remove()
            }
            
        }
        //规格编辑键盘时间
        $(document).on('keydown','.dininput123',function(e){
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if(e && e.keyCode==13){
                inpYes1Click()
            }
        });
        var span=0
        //规格编辑
        function inpYes1Click(){
            span++
            var siid='new'+span
            var inputval = $(".dininput123").val()
            var arr_H = $(".specificaz")
            var guiArr = []
            var pan = true;
            Array.from(arr_H).forEach(function(domH,indH){
                guiArr.push(domH.childNodes[0].innerHTML)
            })
            guiArr.forEach(function(guiArrH,guiArru){
                if(guiArrH == inputval){
                    alert("规格名重复")
                    pan = false;
                    return false;
                }
            })
            if(pan){
                if(inputval != ''){
                    var divs = $("<div class='specificaz' id='"+siid+"' draggable = 'true'><div class='text'>"+inputval+"</div><text class='iconfont fff  delInp' did='"+siid+"' onclick='specificaDel(this)'>删除</text></div");
                    $(divs).appendTo(".newAdds");
                    $(".dininput123").val('')
                }else{
                    alert("规格名不能为空")
                    return false;
                }
            }

        }
        var delarr_h = []
        function specificaDel(domm){
            var did = domm.getAttribute("did")
            var rank = did.slice(0,1);
            if(rank != 'n'){
                var obj={
                    id:did
                }
                delarr_h.push(obj)
           }
           domm.parentNode.remove()
        }

        // 关闭弹框
        function padlocks(){
            $("#messagedivs").css("display","none")
            $(".popup").remove()
        }
        //员工订单部门选择
        function department(){
            // console.log($("input[name='staffsp']:checked").attr("sid"))
            // console.log($("input[name='staffsp']:checked").attr("cid"))
            $('#iframe').contents().find("#staffHiddens").html($("input[name='staffsp']:checked").attr("sid"));
            $("#messagedivs").css("display","none")
            $(".popup").remove()
        }
        //分发活动成员选择
        function dispenses(){
            //  console.log($("input[name='dispense']:checked").attr("sid"))
            // console.log($("input[name='dispense']:checked").attr("cid"))
            var dispenseArr = []
            // var pan = 0;
            var dispense = document.querySelectorAll('.dispense');
            // pan++;
            var div='';
            Array.from(dispense).forEach(function(a,b){
                if(a.checked){
                    if(div){
                        div = div + "<div class='dispenseSon' sid='"+a.getAttribute('cid')+"'>"+a.getAttribute('sid')+"</div>"
                    }else{
                        div = "<div class='dispenseSon' sid='"+a.getAttribute('cid')+"'>"+a.getAttribute('sid')+"</div>"
                    }
                }
             
            })
            // console.log(div)
            // console.log($('#iframe').contents().find("#dispenses"))
            // console.log($('#iframe').contents().find("#dispenses").children())
            var dispensesSon = $('#iframe').contents().find("#dispenses").children()
           if(dispensesSon.length>0){
                dispensesSon.each(function(c,d){
                    d.remove()
                })
            }


            $(div).appendTo($('#iframe').contents().find("#dispenses"))
            div=''


            // $('#iframe').contents().find("#dispenses").html(dispenseArr);
            // $('#iframe').contents().find("#staffHidden").val($("input[name='dispense']:checked").attr("sid"));


            $("#messagedivs").css("display","none")
            $(".popup").remove()
        }
        //授权弹出框
        $(function(){
            function shou(){
                bootbox.dialog({ 
                    message: "<div class='row'><div class='accredit'>欢迎使用四川新华扬科技有限公司名片系统管理平台</div><div class='accreditBott'><div class='accreditBottL'><div class='accreditBottLnei'><div class='accreditBoImg'><img src='../imgs/index/routine.png'></img></div><p class='company'>小程序授权</p><p class='yes mini'>未授权</p><div class='routineAccredit'>马上授权</div></div></div><div class='accreditBottR'><div class='accreditBottRnei'><div class='accreditBoImg'><img src='../imgs/index/company.png'></img></div><p class='company contact'>企业微信授权</p><p class='yes boss'>未授权</p><div class='companyAccredit'>马上授权</div></div></div></div></div>",
                })
                 $(".modal-content").css("margin-top","20%")
                 // class="bootbox-close-button close"
                 $(".bootbox-close-button").css("display","none")
            }
            //设置右边显示高度
            // console.log(document.documentElement.clientHeight)
            // console.log(window.innerHeight)

            
            var height = document.documentElement.clientHeight - 75 + 'px';
            $("#page-content").css("height",height)

            $.ajax({
                url:"https://minitest.17jxyx.com/api/v1/thirdapp/auth_info",
                type:"GET",
                beforeSend: function (request) {
                    request.setRequestHeader('token', window.base.getLocalStorage('token'));
                },
                success:function(res){
                    $("#loads").css("display","none")
                console.log(res)
                // var res = {mini: 0, contact: 0, ai: 0, boss: 0}
                // $.each(res, function(index, el) {
                    // console.log(el,index)
                    if(res.mini == 0 || res.contact == 0 || res.ai == 0 || res.boss == 0){
                    // if(el == 0 && $(".bootbox").length == 0){
                        // console.log(res.mini)
                        // console.log(res.contact)

                        // console.log(res.ai)
                        // console.log(res.boss)

                        shou()
                        //小程序授权
                        if(res.mini == 1){
                            $(".mini").html("已授权");
                             $(".routineAccredit").click(function(){
                                alert("您已经授权成功");
                            })
                        }else{
                            $(".routineAccredit").click(function(){
                                window.location.href = 'accredit/routine.html';

                            })
                        }
                        //企业号授权
                        // console.log(res.contact,res.ai,res.boss)
                        if(res.contact == 1 && (res.ai == 0 ||res.boss == 0)){
                            $(".contact").html("应用授权");
                            $(".companyAccredit").click(function(){
                                window.location.href = 'accredit/company.html';
                            })
                        }
                        if(res.contact == 1 && res.ai == 1 && res.boss == 1){
                            $(".boss").html("已授权");
                            $(".companyAccredit").click(function(){
                                alert("您已经授权成功");
                            })
                        }else{
                            $(".companyAccredit").click(function(){
                                window.location.href = 'accredit/company.html';
                            })
                        }
                        $(".modal-content").css("margin-top","20%")
                             
                    }
                },
                error:function(res){

                }
            });
         })
    </script>
</body>

</html>
